package bx.job.entity;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class BxLogInfo {
    // 任务状态码
    public static final byte LOGGED_STATUS = 1;
    public static final byte ISSUED_STATUS = 2;
    public static final byte WORKED_STATUS = 3;
    public static final byte SUCCESS_COMPLETED_STATUS = 4;
    public static final byte FAILED_COMPLETED_STATUS = 5;

    // 任务错误码
    public static final byte NO_WORKER_LIST_ERROR_CODE = 1; // 找不到 worker list
    public static final byte DISPATCH_WORKER_ERROR_CODE = 2; // 下发任务到 worker 失败
    public static final byte RETRY_COUNT_LIMITED_ERROR_CODE = 3; // 下发任务到 worker 失败
    public static final byte NO_AVAILABLE_WORKER_ERROR_CODE = 4; // 下发任务到 worker 失败

    private long id;
    private long jobId;
    private String jobDescription;
    private long createTime;        // 创建时间
    private long updateTime;        // 更新时间
    private String workerAddress; // 可能因为重试存在多个，用 分号 隔开
    private String routeStrategyName;
    private String workMsg; // 执行必要日志
    private byte retryCount; //  重试次数
    private long triggerId; // 所属触发器 ID
    // TODO 分片参数？

    private byte errorCode; // 错误号

    private long issueTime;
    private byte status; // 任务执行状态

    private int alarmStatus; // 报警状态
}
